/***************************************************************************
 *   Copyright (C) 2010 by Oleg Goncharov  *
 *   $EMAIL$                           *                          
 *                                                                         *
 *   This file is part of ChessVision.                                     *
 *                                                                         *
 *   ChessVision is free software; you can redistribute it and/or modify   *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef CHOUGHDETECTOR_H
#define CHOUGHDETECTOR_H

#include <opencv/cxcore.h>

#include "define.h"
#include "cintegraldetector.h"

namespace Chess {

/**
Для нахождения доски используется метод Hough.

	@author Goncharov Oleg <goncharovoi@yandex.ru>
*/
class CHoughDetector : public CIntegralDetector {
protected:
// пределы изменения положения доски
	int min_h, max_h;
	SRectF O_rect;
// шаги изменнения
	float step_teta;
	float step_h;
	float step_x, step_y;
	int xystep_mul;

protected:
	void CalcLimitsSteps(CvSize size, float h);
	
public:
	CHoughDetector();
	
	void SetStep_h(int sh) { step_h = sh; }
	void SetStep_teta(double steta) { step_teta = steta; }
	void SetXYStepMultipler(int mul) { xystep_mul = mul; }
	
	bool DetectChessboard(IplImage * src, CBoardCells& cells);	
};

}

#endif
